//
//  LikeViewController.m
//  结伴
//
//  Created by wsl on 16/8/25.
//  Copyright © 2016年 aleven. All rights reserved.
//

#import "LikeViewController.h"

#import "Jpcollectionview.h"
#import "MyCollectionViewCell.h"


@interface LikeViewController ()<UISearchBarDelegate,UICollectionViewDelegate,UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, UISearchBarDelegate>
@property (nonatomic, strong) UICollectionView *myCollectView;
@end

@implementation LikeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.title = @"喜欢";
    //self.myCollectView.hidden = NO;
    
    [self myCollectView];
  }

-(UICollectionView *)myCollectView {
    if (!_myCollectView) {
        
        Jpcollectionview *ll = [[Jpcollectionview alloc] init];
        

        ll.headerReferenceSize = CGSizeMake(Swidth, 5);
        
        
        _myCollectView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0,[UIScreen mainScreen].bounds.size.width , [UIScreen mainScreen].bounds.size.height) collectionViewLayout:ll];
        
       // [layout setHeaderReferenceSize:CGSizeMake(_myCollectView.frame.size.width,10)];
        
        [_myCollectView registerNib:[UINib nibWithNibName:@"MyCollectionViewCell" bundle:nil] forCellWithReuseIdentifier:@"cell"];
        
        [self.view addSubview:_myCollectView];
        
        _myCollectView.delegate = self;
        _myCollectView.dataSource = self;
        _myCollectView.backgroundColor = [UIColor whiteColor];
        
    }
    return _myCollectView;
    
}



-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
    return 1;
}

-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    
    return 15;
    
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    
    MyCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
    cell.myImage.image = [UIImage imageNamed:[NSString stringWithFormat:@"%ld", (long)indexPath.item]];
    return cell;
    
}


// 设置是否允许移动
- (BOOL)collectionView:(UICollectionView *)collectionView canMoveItemAtIndexPath:(NSIndexPath *)indexPath {
    return YES;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
